﻿<Window
    Name="OpenStoryWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
    mc:Ignorable="d" 
    x:Class="StoryMaker.Application.OpenStory"
        Title="Open Story..." Height="311" Width="350" d:DataContext="{d:DesignData /SampleData/OpenStoryViewModelSampleData.xaml}" WindowStyle="ToolWindow">
	<Window.Resources>
		<ItemsPanelTemplate x:Key="ItemsWrapPanel">
			<WrapPanel IsItemsHost="True" MaxWidth="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType=ListView, AncestorLevel=1}, Path=ActualWidth}" />
		</ItemsPanelTemplate>
		<DataTemplate x:Key="FirstPageDataTemplate">
			<Grid>
				<ContentControl Content="{Binding FirstPage.Shapes}" ContentTemplate="{DynamicResource PageDataTemplate}" Width="50" Height="50">
					
				</ContentControl>
			</Grid>
		</DataTemplate>
	</Window.Resources>
    <Grid>
    	<Grid.RowDefinitions>
    		<RowDefinition/>
    		<RowDefinition Height="Auto" />
    	</Grid.RowDefinitions>
		<ListView ItemsSource="{Binding Stories}" SelectedItem="{Binding SelectedStory}" ItemsPanel="{DynamicResource ItemsWrapPanel}" ItemTemplate="{DynamicResource FirstPageDataTemplate}" />
    	<StackPanel Orientation="Horizontal" d:LayoutOverrides="Width" Grid.Row="1" HorizontalAlignment="Center">
    		<Button Content="OK" Height="23" Command="Close" x:Name="buttonOK" VerticalAlignment="Top" Width="75" CommandTarget="{Binding ElementName=OpenStoryWindow}" />
    		<Button Content="Cancel" Height="23" HorizontalAlignment="Left" Command="Close" x:Name="buttonCancel" VerticalAlignment="Top" Width="75" />
    	</StackPanel>
    </Grid>
</Window>
